export function getBaseUrl () {
    const config = useRuntimeConfig()
    console.log('Runtime config:', config)
    if (process.server) {
    console.log('API secret:', config.public.VITE_API_HOST)
    return config.public.VITE_API_HOST
    } else {
        return '/api'
    }

}

export function getSeacrhApi() {
    const url = `${getBaseUrl()}/articles/search`
    console.log("🚀 ~ file: api.ts:15 ~ getSeacrhApi ~ url:", url)
    return url
}


export async function requestList() {
    const url = `${getBaseUrl()}/articles/search`
    const result = await $fetch(url)
    return result.data.data
}